#!/usr/bin/env python
# -*- coding:utf-8 -*-

# src/grujieclient/globe.py

# Copyright (C) 2009 Gong Han <gong AT fedoraproject.org>

# This file is part of gRuijieClient.

# gRuijieClient is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; version 3 only.

# gRuijieClient is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with gRuijieClient. If not, see <http://www.gnu.org/licenses/>.

"""
RuijieClient glade define
@author: Gong Han
"""

import sys

try:
    import pygtk
    pygtk.require("2.0")
except:
    pass
try:
    import gtk
    import gtk.glade
except:
    print >> sys.stderr, "Error: PyGTK is not installed"
    sys.exit(1)

try:
    import gettext
except:
    print >> sys.stderr, "Error: Pygettext is not installed"
    sys.exit(1)

if gtk.pygtk_version < (2, 10, 0):
    errtitle = "Error"
    errmsg = "PyGTK >= 2.10.0 required"
    if gtk.pygtk_version < (2, 4, 0):
        print >> sys.stderr, errtitle + ": " + errmsg
    else:
        errdlg = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, 
                                   buttons=gtk.BUTTONS_OK)
        errdlg.set_title(errtitle)
        errdlg.set_markup(errmsg)
        errdlg.run()
    sys.exit(1)


# constants
GLADE_DIR = sys.path[0] + '/gruijieclient/glade/'
ICON = 'gruijieclient_48.png'
ICON_DISCON = 'gruijieclient_discon_48.png'
GLADE = 'gruijieclient.glade'
GRUIJIECLIENT_IMAGE = GLADE_DIR + ICON
GRUIJIECLIENT_IMAGE_DISCON = GLADE_DIR + ICON_DISCON
GRUIJIECLIENT_GLADE = GLADE_DIR + GLADE
VERSION = '0.1'
RC_DOMAIN = 'gruijieclient'
LOCALE_DIR = "/usr/share/locale"

# load glade file
try:
    GladeUI = gtk.glade.XML(GRUIJIECLIENT_GLADE, domain=RC_DOMAIN)
except:
    print >> sys.stderr, 'can not load ' + GLADE
    sys.exit(1)

